package org.brakepedal.server.support.http;

import java.util.Objects;

/**
 * Date: 2023/2/13 16:38

 
 */
public abstract class AbstractEnumConverter<K,V> {
    abstract V getValue();

    public K getKey() {
        return null;
    }

    public boolean hasSameValue(Object value) {
        Objects.requireNonNull(value);
        if(value instanceof EnumConverter<?,?>) {
            return value.equals(this);
        }
        return value.equals(getValue());
    }

    @Override
    public String toString() {
        return '{'+getValue().toString()+'}';
    }
}
